var common = require('../common');
var store = common.store;
var getFile = common.getFile;
module.exports = {
    // mock 请求
    "post /getCategoryTree": function(req, res) {
        var pid = req.body.pId;
        var data;
        if (pid == '') {
            data = [{
                id: 1,
                pId: 0,
                name: "枪械大全",
                isParent: true,
                open: true
            }, {
                id: 5,
                pId: 0,
                isParent: true,
                name: "最新攻略"
            }];
        } else if (pid == 1) {
            data = [{
                id: 2,
                pId: 1,
                name: "机枪",
                open: true
            }, {
                id: 3,
                pId: 1,
                name: "手枪"
            }, {
                id: 4,
                pId: 1,
                name: "冲锋枪"
            }];
        } else if (pid == 5) {
            data = [{
                id: 6,
                pId: 5,
                isParent: true,
                name: "PVP"
            }, {
                id: 10,
                pId: 5,
                name: "PVE"
            }];
        } else if (pid == 6) {
            data = [{
                id: 7,
                pId: 6,
                name: "战歌峡谷"
            }, {
                id: 8,
                pId: 6,
                name: "阿拉希"
            }, {
                id: 9,
                pId: 6,
                name: "奥山"
            }];
        }
        res.send({
            "result": "success",
            "messages": [],
            "fieldErrors": {},
            "errors": [],
            "data": [{
                id: 1,
                pId: 0,
                name: "枪械大全",
                isParent: true,
                open: true
            }, {
                id: 2,
                pId: 1,
                name: "机枪",

                open: true
            }, {
                id: 3,
                pId: 1,
                name: "手枪"
            }, {
                id: 4,
                pId: 1,
                name: "冲锋枪"
            }, {
                id: 5,
                pId: 0,
                isParent: true,
                name: "最新攻略"
            }, {
                id: 6,
                pId: 5,
                isParent: true,
                name: "PVP"
            }, {
                id: 7,
                pId: 6,
                name: "战歌峡谷"
            }, {
                id: 8,
                pId: 6,
                name: "阿拉希"
            }, {
                id: 9,
                pId: 6,
                name: "奥山"
            }, {
                id: 10,
                pId: 5,
                name: "PVE"
            }]
        });
    },
    // mock freeMarker 文件
    "get /url": function(req, res) {
        this.render.ftl(getFile('path'), store);
    }

};